<?php
include_once('common/header.php');		
$arrParam	= $objRequest->getParams();
if(isset($arrParam) && isset($arrParam['keyword'])) {	
	$objVfriendUser	= new Vfriend_User();
	if(!isset($intAjax)) {
		$intOwnerId = $AppUI->id;
	}
	$objBlog 		= new Blog();	
	$intTotal		= 0;
	$intLimit		= BLOG_LIMIT;
	$intPage		= $objRequest->getParam('page', 1);
	$strKeyword		= $objRequest->getParam('keyword', '');	
	$intOffset		= ($intPage - 1) * $intLimit;	
	if($intOwnerId) {
		$strFriend 	= $objVfriendUser->getRelation($intOwnerId);			
	} else {
		$strFriend	= '';
	}
	$arrResult					= $objBlog->getSearch($intOwnerId,$strKeyword,$strFriend,$intOffset,$intLimit,$intTotal);
	$this->view->arrResult		= $arrResult;	
	$this->view->intTotalPage	= ceil($intTotal / $intLimit);
	$this->view->intPage 		= $intPage;
	$this->view->intOwnerId		= $intOwnerId;	
	if(!isset($intAjax)) {
		$this->view->strKeyword	= $strKeyword;	
	}
}
?>